package com.tuju.jetpackfirstdemo.ui.bugly

import android.os.Bundle
import com.tencent.bugly.crashreport.CrashReport
import com.tuju.jetpackfirstdemo.App
import com.tuju.jetpackfirstdemo.R
import com.tuju.jetpackfirstdemo.base.BaseActivity
import com.tuju.jetpackfirstdemo.utils.ExitUtil
import kotlinx.android.synthetic.main.activity_exception.*

class ExceptionActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_exception)
        initView()
    }

    private fun initView(){
        btn_finish.setOnClickListener {
            ExitUtil.restartApp()
            App.finishActivity()
        }

        btn_destory_task.setOnClickListener {
            ExitUtil.restartApp()
            ExitUtil.exitAPP()
        }

        btn_bugly.setOnClickListener {
            CrashReport.testJavaCrash()
        }

        btn_anr.setOnClickListener {
            CrashReport.testANRCrash()
        }

        btn_zero.setOnClickListener {
            val a = 2 / 0
        }
    }

}
